package com.jindu.producer.finance.jpa;

import com.jindu.producer.finance.model.FHightechEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author jarvischang
 * @date 2018-10-19
 */
@Transactional
public interface HightechJpa extends JpaRepository<FHightechEntity,Long>,JpaSpecificationExecutor {

    /**
     * 根据id 查询 单个实体
     * @param id
     * @return
     */
    FHightechEntity findById(String id);


    /**
     * 根据用户的id 查询信息
     * @param userId
     * @return
     */
    FHightechEntity findByUserId(String userId);


    /**
     * 根据orgid查询
     * @param orgId
     * @return
     */
    FHightechEntity findByOrgId(Integer orgId);


    /**
     * 根据id删除数据
     * @param id
     * @return
     */
    @Modifying
    @Query("delete from FHightechEntity where id = ?1 ")
    int deleteById(String id);


}
